//
//  MutipleBarChartViewController.m
//  饼线柱状图
//
//  Created by ma c on 13/8/18.
//  Copyright © 2018年 子房. All rights reserved.
//

#import "MutipleBarChartViewController.h"
#import "SSWMutipleBarChartView.h"

@interface MutipleBarChartViewController ()<SSWChartsDelegate>

@end

@implementation MutipleBarChartViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self makeTheMutiolesBar];
}

-(void)makeTheMutiolesBar
{
    SSWMutipleBarChartView * mutipleBar = [[SSWMutipleBarChartView alloc] initWithChartType:SSWChartsTypeBar];
    mutipleBar.backgroundColor = [UIColor orangeColor];
    mutipleBar.xValuesArr = [@[@"2015",@"2016",@"2017",@"2018",@"2019",@"2020",@"2021"] mutableCopy];
    mutipleBar.yValuesArr = [@[@[@"100",@"200",@"300"],
                                @[@"80",@"210",@"150"],
                                @[@"100",@"200",@"300"],
                                @[@"100",@"200",@"300"],
                                @[@"100",@"200",@"300"],
                                @[@"100",@"200",@"300"],
                                @[@"100",@"200",@"300"]] mutableCopy];
    mutipleBar.unit = @"吨";
    mutipleBar.delegate = self;
    mutipleBar.legendTitlesArr = [@[@"小麦",@"玉米",@"大豆"] mutableCopy];
    mutipleBar.frame = CGRectMake(0, 100, self.view.bounds.size.width, 300);
//    mutipleBar.barColorArr = [@[[UIColor greenColor],[UIColor blueColor],[UIColor redColor]] mutableCopy];
    [self.view addSubview:mutipleBar];
    
}

- (void)SSWChartView:(SSWCharts *)chartView didSelectMutipleBarChartIndex:(NSArray *)index
{
    NSLog(@"点击的是(%d,%d)",[index[0] intValue],[index[1] intValue]);
}

@end
